﻿using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.ServiceLocation;
using SearchScreen.SDK;
using SearchScreen.SDK.Infrastructure;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Xml.Serialization;

namespace SearchScreen.SearchScreenModule.ViewModel
{
    class RequestEditorViewModel
    {
        public ObservableCollection<ISearchExpression> Expressions { get; private set; }

        public RequestEditorViewModel()
        {
            this.Expressions = new ObservableCollection<ISearchExpression>();

            var evt = ServiceLocator.Current.GetInstance<IEventAggregator>();
            evt.GetEvent<CriteriaTupleToRequestEditorEvent>().Subscribe(
            (p) => 
                {
                    this.Expressions.Add(p.Expression);
                }
            );

        }

    }
}

